package com.dhsc.service.impl.wdywgl;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhsc.domain.ywzx.wdywgl.GpspkhmxVo;
import com.dhsc.domain.yypt.LayuiTableVo;
import com.dhsc.exception.MyException;
import com.dhsc.local.dao.wdywgl.IGpspkhmxDao;
import com.dhsc.service.wdywgl.IGpspkhmxService;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;

import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName: GpspkhmxServiceImpl
 * @Description: 股票索赔客户明细
 * @date: 2024/3/8 14:07
 * @author: jwj
 */
@Service
@Slf4j
public class GpspkhmxServiceImpl implements IGpspkhmxService {

    @Autowired
    private IGpspkhmxDao gpspkhmxDao;

    @Override
    public LayuiTableVo queryGpspkhmx(GpspkhmxVo gpspkhmxVo) {
        LayuiTableVo obj = new LayuiTableVo();
        try {
            //如果是导出，则查所有记录
            if(gpspkhmxVo.getExportFlag()!=1){
                PageMethod.startPage(gpspkhmxVo.getPage(),gpspkhmxVo.getLimit());
            }
            List<GpspkhmxVo> list = gpspkhmxDao.queryGpspkhmx(gpspkhmxVo);
            PageInfo<GpspkhmxVo> pageInfo = new PageInfo<>(list);
            obj.setData(list);
            obj.setCount(pageInfo.getTotal());
            obj.setCode(0);
            obj.setMsg("");
        }catch (Exception e){
            log.error("查询股票索赔客户明细异常",e);
            throw new MyException("查询股票索赔客户明细异常",e);
        }
        return obj;
    }
}
